3.675 \(\int (a+b \sec (c+d x)) (a^2-b^2 \sec ^2(c+d x)) \, dx\)

Optimal. Leaf size=75 \[ a^3 x+\frac {b \left (2 a^2-b^2\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}-\frac {a b^2 \tan (c+d x)}{2 d}-\frac {b^2 \tan (c+d x) (a+b \sec (c+d x))}{2 d} \]

[Out]

a^3*x+1/2*b*(2*a^2-b^2)*arctanh(sin(d*x+c))/d-1/2*a*b^2*tan(d*x+c)/d-1/2*b^2*(a+b*sec(d*x+c))*tan(d*x+c)/d

________________________________________________________________________________________

Rubi [A]  time = 0.09, antiderivative size = 75, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.179, Rules used = {4042, 3918, 3770, 3767, 8} \[ \frac {b \left (2 a^2-b^2\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+a^3 x-\frac {a b^2 \tan (c+d x)}{2 d}-\frac {b^2 \tan (c+d x) (a+b \sec (c+d x))}{2 d} \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Sec[c + d*x])*(a^2 - b^2*Sec[c + d*x]^2),x]

[Out]

a^3*x + (b*(2*a^2 - b^2)*ArcTanh[Sin[c + d*x]])/(2*d) - (a*b^2*Tan[c + d*x])/(2*d) - (b^2*(a + b*Sec[c + d*x])
*Tan[c + d*x])/(2*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3767

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> -Dist[d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 3770

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3918

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_)), x_Symbol] :> -Simp[(b*
d*Cot[e + f*x]*(a + b*Csc[e + f*x])^(m - 1))/(f*m), x] + Dist[1/m, Int[(a + b*Csc[e + f*x])^(m - 2)*Simp[a^2*c
*m + (b^2*d*(m - 1) + 2*a*b*c*m + a^2*d*m)*Csc[e + f*x] + b*(b*c*m + a*d*(2*m - 1))*Csc[e + f*x]^2, x], x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && GtQ[m, 1] && NeQ[a^2 - b^2, 0] && IntegerQ[2*m]

Rule 4042

Int[((A_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.))*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_.), x_Symbol] :> Dist[
C/b^2, Int[(a + b*Csc[e + f*x])^(m + 1)*Simp[-a + b*Csc[e + f*x], x], x], x] /; FreeQ[{a, b, e, f, A, C, m}, x
] && EqQ[A*b^2 + a^2*C, 0]

Rubi steps

\begin {align*} \int (a+b \sec (c+d x)) \left (a^2-b^2 \sec ^2(c+d x)\right ) \, dx &=-\int (-a+b \sec (c+d x)) (a+b \sec (c+d x))^2 \, dx\\ &=-\frac {b^2 (a+b \sec (c+d x)) \tan (c+d x)}{2 d}-\frac {1}{2} \int \left (-2 a^3-b \left (2 a^2-b^2\right ) \sec (c+d x)+a b^2 \sec ^2(c+d x)\right ) \, dx\\ &=a^3 x-\frac {b^2 (a+b \sec (c+d x)) \tan (c+d x)}{2 d}-\frac {1}{2} \left (a b^2\right ) \int \sec ^2(c+d x) \, dx+\frac {1}{2} \left (b \left (2 a^2-b^2\right )\right ) \int \sec (c+d x) \, dx\\ &=a^3 x+\frac {b \left (2 a^2-b^2\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}-\frac {b^2 (a+b \sec (c+d x)) \tan (c+d x)}{2 d}+\frac {\left (a b^2\right ) \operatorname {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{2 d}\\ &=a^3 x+\frac {b \left (2 a^2-b^2\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}-\frac {a b^2 \tan (c+d x)}{2 d}-\frac {b^2 (a+b \sec (c+d x)) \tan (c+d x)}{2 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.02, size = 75, normalized size = 1.00 \[ a^3 x+\frac {a^2 b \tanh ^{-1}(\sin (c+d x))}{d}-\frac {a b^2 \tan (c+d x)}{d}-\frac {b^3 \tanh ^{-1}(\sin (c+d x))}{2 d}-\frac {b^3 \tan (c+d x) \sec (c+d x)}{2 d} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Sec[c + d*x])*(a^2 - b^2*Sec[c + d*x]^2),x]

[Out]

a^3*x + (a^2*b*ArcTanh[Sin[c + d*x]])/d - (b^3*ArcTanh[Sin[c + d*x]])/(2*d) - (a*b^2*Tan[c + d*x])/d - (b^3*Se
c[c + d*x]*Tan[c + d*x])/(2*d)

________________________________________________________________________________________

fricas [A]  time = 0.47, size = 116, normalized size = 1.55 \[ \frac {4 \, a^{3} d x \cos \left (d x + c\right )^{2} + {\left (2 \, a^{2} b - b^{3}\right )} \cos \left (d x + c\right )^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (2 \, a^{2} b - b^{3}\right )} \cos \left (d x + c\right )^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (2 \, a b^{2} \cos \left (d x + c\right ) + b^{3}\right )} \sin \left (d x + c\right )}{4 \, d \cos \left (d x + c\right )^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(d*x+c))*(a^2-b^2*sec(d*x+c)^2),x, algorithm="fricas")

[Out]

1/4*(4*a^3*d*x*cos(d*x + c)^2 + (2*a^2*b - b^3)*cos(d*x + c)^2*log(sin(d*x + c) + 1) - (2*a^2*b - b^3)*cos(d*x
 + c)^2*log(-sin(d*x + c) + 1) - 2*(2*a*b^2*cos(d*x + c) + b^3)*sin(d*x + c))/(d*cos(d*x + c)^2)

________________________________________________________________________________________

giac [F(-1)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(d*x+c))*(a^2-b^2*sec(d*x+c)^2),x, algorithm="giac")

[Out]

Timed out

________________________________________________________________________________________

maple [A]  time = 0.95, size = 94, normalized size = 1.25 \[ a^{3} x +\frac {a^{3} c}{d}-\frac {a \,b^{2} \tan \left (d x +c \right )}{d}+\frac {a^{2} b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}-\frac {b^{3} \sec \left (d x +c \right ) \tan \left (d x +c \right )}{2 d}-\frac {b^{3} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2 d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*sec(d*x+c))*(a^2-b^2*sec(d*x+c)^2),x)

[Out]

a^3*x+1/d*a^3*c-a*b^2*tan(d*x+c)/d+1/d*a^2*b*ln(sec(d*x+c)+tan(d*x+c))-1/2*b^3*sec(d*x+c)*tan(d*x+c)/d-1/2/d*b
^3*ln(sec(d*x+c)+tan(d*x+c))

________________________________________________________________________________________

maxima [A]  time = 0.36, size = 93, normalized size = 1.24 \[ \frac {4 \, {\left (d x + c\right )} a^{3} + b^{3} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 4 \, a^{2} b \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) - 4 \, a b^{2} \tan \left (d x + c\right )}{4 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(d*x+c))*(a^2-b^2*sec(d*x+c)^2),x, algorithm="maxima")

[Out]

1/4*(4*(d*x + c)*a^3 + b^3*(2*sin(d*x + c)/(sin(d*x + c)^2 - 1) - log(sin(d*x + c) + 1) + log(sin(d*x + c) - 1
)) + 4*a^2*b*log(sec(d*x + c) + tan(d*x + c)) - 4*a*b^2*tan(d*x + c))/d

________________________________________________________________________________________

mupad [B]  time = 3.59, size = 137, normalized size = 1.83 \[ \frac {2\,a^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}-\frac {b^3\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}-\frac {b^3\,\sin \left (c+d\,x\right )}{2\,d\,{\cos \left (c+d\,x\right )}^2}+\frac {2\,a^2\,b\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}-\frac {a\,b^2\,\sin \left (c+d\,x\right )}{d\,\cos \left (c+d\,x\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a^2 - b^2/cos(c + d*x)^2)*(a + b/cos(c + d*x)),x)

[Out]

(2*a^3*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d - (b^3*atanh(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d -
 (b^3*sin(c + d*x))/(2*d*cos(c + d*x)^2) + (2*a^2*b*atanh(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d - (a*b^2*s
in(c + d*x))/(d*cos(c + d*x))

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (a - b \sec {\left (c + d x \right )}\right ) \left (a + b \sec {\left (c + d x \right )}\right )^{2}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(d*x+c))*(a**2-b**2*sec(d*x+c)**2),x)

[Out]

Integral((a - b*sec(c + d*x))*(a + b*sec(c + d*x))**2, x)

________________________________________________________________________________________